/**
 * loading组件
 */
var React = require('react-native');
var ProgressBar = require('ProgressBarAndroid');

var {
  View,
  ActivityIndicatorIOS,
  StyleSheet,
  Platform
} = React;


/**
 * Usage
 * var {Loading} = require('qmkit');
 *
 * <Loading/>
 */
var QMLoading = React.createClass({
  render() {
    return (
      <View style={[styles.loading, this.props.style]}>
        {
          Platform.OS === 'ios' ?
            <ActivityIndicatorIOS size='small'/>
            :
            <ProgressBar styleAttr='LargeInverse' style={styles.progress}/>
        }
      </View>
    );
  }
});


/**
 * style
 */
var styles = StyleSheet.create({
  loading: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center'
  },
  progress: {
    width: 30,
    height: 30
  }
});


//expose
module.exports = QMLoading;
